package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.Car;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ICarService;
import cn.wolfcode.crm.util.PageResult;
import cn.wolfcode.crm.util.PermissionName;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("car")
public class CarController {
    @Autowired
    private ICarService service;
    @RequestMapping("")
    private String index(){
        return "car/list";
    }


    @RequestMapping("list")
    @ResponseBody
    @RequiresPermissions("car:list")
    @PermissionName("车辆信息列表")
    private PageResult list(QueryObject qo){
        return service.query(qo);
    }
    @RequestMapping("queryCar")
    @ResponseBody
    @RequiresPermissions("car:list")
    @PermissionName("查询车辆信息数据")
    private List<Car> list(){
        return service.getAll();
    }

}
